<meta name="content-type" content="text/html; charset=UTF-8" />
<!-- #set(PaginatedList<HomePageTaskRecord> pl) -->
<!--
		#set(
		pager = pl.pager,
		totalResults = pager.getCountOfTotalResults(),
		totalPages = pager.getCountOfTotalPages() * 1,
		pageSize = pager.pageSize,
		pageNo = pager.pageNo,
		prePageNo = pager.getPrevPageNo(),
		nextPageNo = pager.getNextPageNo()
		)
		#set(date = new Date().format("yyyy-MM-dd"))
-->
<!--#if(pl)-->
<div class="panel-heading panel-result-title">
	<h3 class="panel-title">查询结果</h3>
	<div class="btn-group btn-gp-default">
	<button id="btn_add" type="button"
			class="btn btn-default panel-radius-left">添加</button>
		<button id="btn_edit" type="button"
			class="btn btn-default panel-radius-none">修改</button>
		<button id="btn_delete" type="button"
			class="btn btn-default panel-radius-none">删除</button>
		<button id="btn-export" type="button"
			class="btn btn-default panel-radius-right">导出</button>
	</div>
</div>
<table class="table table-bordered table-hover table-condensed tb"
	style="text-align: center">
	<tr>
		<td><input id="chkallIds" type="checkbox" /></td>
		<td class="tb-teacher">工作安排</td>
		<td>到期时间</td>
		<td class="tb-teacher">会员编号</td>
		<td class="tb-teacher">姓名</td>
		<td class="tb-teacher">手机号</td>
		<td class="tb-teacher">信息来源</td>
		<td class="tb-teacher">会员状态</td>
		<td class="tb-teacher">会员子状态</td>
		<td class="tb-teacher">任务状态</td>
	</tr>
	<!-- #for(HomePageTaskRecord record:pl) -->
	<tr>
		<td><input name="chk_name" type="checkbox" value="${record.rwbh}" /></td>
		<td><a href="yueyogaAdmin/toViewTask.jhtml?taskId=${record.rwbh}">${record.gzap}</a></td>
		<td>${record.dqsj}</td>
		<td>
		<a href="yueyogaAdmin/toMemberTask.jhtml?id=${record.hybh}">${record.hykh}</a>
		<td>
		<a href="yueyogaAdmin/toMemberTask.jhtml?id=${record.hybh}">${record.hyxm}</a>
		</td>
		<td>
		<a href="yueyogaAdmin/toMemberTask.jhtml?id=${record.hybh}">${record.hysjh}</a>
		</td>
		<td>
		<!-- #if(record.xxly=='81') -->
			电话打入
			<!-- #else(record.xxly=='82') -->
			主动拜访
			<!-- #else(record.xxly=='83') -->
			数据库
			<!-- #else(record.xxly=='84') -->
			线上活动
			<!-- #else(record.xxly=='85') -->
			线下活动
			<!-- #else(record.xxly=='86') -->
			其他
			<!-- #else-->
			&nbsp;
			<!-- #end -->
		</td>
		<td>${record.hyzt}</td>
		<td>${record.hyzzt}</td>
		<td>${record.rwzt}</td>
	</tr>
<!--#end-->
</table>

<!-- 列表分页 -->
<div class="paging-page">$!{include("paging_page.html")}</div>

<!-- #else -->
<div class="panel-body">没有符合条件的数据</div>
<!-- #end -->

<script type="text/javascript">
	$(function() {
		var ids = [];
		//删除
		$("#btn_delete").click(function() {
			$('input[name="chk_name"]:checked').each(function() {
				ids.push($(this).val());
			});
			if (ids.length == 0) {
				alert("请选择要删除的记录!");
				return;
			}else if(ids.length > 0){
				confirm("确定要删除吗?",function(){
					this.close();
					var d = wait("正在删除，请稍候...");
					var url = "yueyogaAdmin/deleteTasksByIds.jhtml?ids=" + ids;
					$.post(url, function(msg) {
						if (msg == 'true') {
							d.content("删除成功!");
							setTimeout(function(){
							d.close().remove();
							}, 400);
							$("form[name='taskForm']").submit();
							 $("input[name='chk_name']").prop("checked",false);
						} else {
							d.close().remove();
							alert("删除失败!");
						}
					});
				});
			}
		});
		$("#btn_edit").click(function() {
			$('input[name="chk_name"]:checked').each(function() {
				ids.push($(this).val());
			});
			if (ids.length == 1) {
				window.location.href = "yueyogaAdmin/toEditTask.jhtml?taskId="+ ids;
			} else {
				alert("请选择一条记录进行修改!");
			}
			ids = [];
		});
		$("#btn_add").click(function(){
			window.location.href = "yueyogaAdmin/toAddTask.jhtml";
		});
		//--全选`反选
		$("#chkallIds").click(function() {
			if (this.checked) {
				$("input[name='chk_name']").each(function() {
					this.checked = true;
				});
			} else {
				$("input[name='chk_name']").each(function() {
					this.checked = false;
				});
			}
		});
		//导出任务                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
		$("#btn-export").click(function(){
			var action = "yueyogaAdmin/exportTaskInfo.jhtml";
			var oldAction = $("form[name='taskForm']").prop("action");
			$("form[name='taskForm']").prop("action",action);
			$("form[name='taskForm']").submit();
			$("form[name='taskForm']").prop("action",oldAction);
		});
	});
	function changePage(value) {
		value = value * 1;
		var newval = value;
		var totalPages = '${totalPages}';
		if (value > totalPages) {
			value = totalPages;
		} else if (value < 1) {
			value = 1;
		}
		$("#txtPageNumber").val(value);
		if(newval > totalPages || newval < 1){
			return;
		}
		goToPage(value);
	}
	function goToPage(pageNo) {
		$("#hidPageNo").val(pageNo);
		var aboutToExpiry = "${aboutToExpiry}";
		var oldAction = $("form[name='taskForm']").prop("action");
		var action = "yueyogaAdmin/searchTasks.jhtml?aboutToExpiry=1&display=block";
		if(aboutToExpiry == "1" ){
			$("form[name='taskForm']").prop("action",action);
			$("form[name='taskForm']").submit();
		}else{
			$("form[name='taskForm']").prop("action",oldAction);
			$("form[name='taskForm']").submit();
		}
	}
</script>